/**
 * @param {string} s
 * @return {boolean}
 */
 var isValid = function(s) {
    let brackets={
        ")":"(",
        "}":"{",
        "]":"["
    };
    let stack=[];
    for(let i=0;i<s.length;i++){
        const s1=s[i];
        //是否有右括号
        if(brackets[s1]){
             const s2=stack[stack.length-1];
             //匹配是否有对应的括号
             if(s2==brackets[s1]){   
                 stack.pop();
             }else{
                 stack.push(s1);//没有就留在栈里
             }
        }else{
            stack.push(s1);
           
        }
    }
    console.log("stack",stack);
    return stack.length?false:true;
};

isValid("(()");